]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network: Remove _createAPItem
authorJasper St. Pierre <jstpierre@mecheye.net>
Fri, 26 Apr 2013 00:39:19 +0000 (20:39 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Thu, 6 Jun 2013 21:16:44 +0000 (17:16 -0400)
The code flows better if this is inlined like this.

https://bugzilla.gnome.org/show_bug.cgi?id=698918

js/ui/status/network.js

index 76127cb6ed6f1509672ace6805379bfaddb35f44..e07fbffd2b9813039b2910a17aa5e58c6f2e1ccd 100644 (file)
@@ -1069,21 +1069,6 @@ const NMDeviceWireless = new Lang.Class({
         }
     },
 
-    _createAPItem: function(connection, accessPointObj) {
-        let item = new NMNetworkMenuItem(accessPointObj.accessPoints[0]);
-        item._connection = connection;
-        item.connect('activate', Lang.bind(this, function() {
-            let accessPoints = accessPointObj.accessPoints;
-            for (let i = 0; i < accessPoints.length; i++) {
-                if (accessPoints[i].connection_valid(connection)) {
-                    this._client.activate_connection(connection, this.device, accessPoints[i].dbus_path, null);
-                    break;
-                }
-            }
-        }));
-        return item;
-    },
-
     _clearSection: function() {
         this.parent();
 
@@ -1180,10 +1165,20 @@ const NMDeviceWireless = new Lang.Class({
             return;
         }
 
+        network.item = new NMNetworkMenuItem(network.accessPoints[0]);
         if(network.connections.length > 0) {
-            network.item = this._createAPItem(network.connections[0], network);
+            let connection = network.connections[0];
+            network.item._connection = connection;
+            network.item.connect('activate', Lang.bind(this, function() {
+                let accessPoints = network.accessPoints;
+                for (let i = 0; i < accessPoints.length; i++) {
+                    if (accessPoints[i].connection_valid(connection)) {
+                        this._client.activate_connection(connection, this.device, accessPoints[i].dbus_path, null);
+                        break;
+                    }
+                }
+            }));
         } else {
-            network.item = new NMNetworkMenuItem(network.accessPoints[0]);
             network.item.connect('activate', Lang.bind(this, function() {
                 let accessPoints = network.accessPoints;
                 if (   (accessPoints[0]._secType == NMAccessPointSecurity.WPA2_ENT)